Histopathology Research Template 🔬
Describe Materials and Methods as highlighted in (Knijn, Simmer, and Nagtegaal 2015).2
Describe patient characteristics, and inclusion and exclusion criteria
Describe treatment details
Describe the type of material used
Specify how expression of the biomarker was assessed
Describe the number of independent (blinded) scorers and how they scored
State the method of case selection, study design, origin of the cases, and time frame
Describe the end of the follow-up period and median follow-up time
Define all clinical endpoints examined
Specify all applied statistical methods
Describe how interactions with other clinical/pathological factors were analyzed
Codes for general settings.3
Setup global chunk settings4
knitr::opts_chunk$set(
eval = TRUE,
echo = TRUE,
fig.path = here::here("figs/"),
message = FALSE,
warning = FALSE,
error = FALSE,
cache = FALSE,
comment = NA,
tidy = TRUE,
fig.width = 6,
fig.height = 4
)Load Library
see R/loadLibrary.R for the libraries loaded.
Codes for generating fake data.5
Generate Fake Data
This code generates a fake histopathological data. Some sources for fake data generation here6 , here7 , here8 , here9 , here10 , here11 , here12 , here13 , and here14 .
Use this code to generate fake clinicopathologic data
Codes for importing data.15
Read the data
library(readxl)
mydata <- readxl::read_excel(here::here("data", "mydata.xlsx"))
# View(mydata) # Use to view data after importingAdd code for import multiple data purrr reduce
Codes for reporting general features.16
Dataframe Report
The data contains 250 observations of the following variables:
- ID: 250 entries: 001, n = 1; 002, n = 1; 003, n = 1 and 247 others
- Name: 249 entries: Adiya, n = 1; Ahlani, n = 1; Ahlaysia, n = 1 and 246 others (1 missing)
- Sex: 2 entries: Female, n = 134; Male, n = 115 (1 missing)
- Age: Mean = 50.16, SD = 14.12, range = [25, 73], 1 missing
- Race: 6 entries: White, n = 158; Hispanic, n = 37; Black, n = 28 and 3 others (1 missing)
- PreinvasiveComponent: 2 entries: Absent, n = 201; Present, n = 48 (1 missing)
- LVI: 2 entries: Absent, n = 152; Present, n = 98
- PNI: 2 entries: Absent, n = 171; Present, n = 78 (1 missing)
- Death: 2 levels: FALSE (n = 70); TRUE (n = 179) and missing (n = 1)
- Group: 2 entries: Treatment, n = 127; Control, n = 122 (1 missing)
- Grade: 3 entries: 3, n = 105; 1, n = 79; 2, n = 65 (1 missing)
- TStage: 4 entries: 4, n = 109; 3, n = 62; 2, n = 51 and 1 other (1 missing)
- Anti-X-intensity: Mean = 2.42, SD = 0.64, range = [1, 3], 1 missing
- Anti-Y-intensity: Mean = 2.02, SD = 0.77, range = [1, 3], 1 missing
- LymphNodeMetastasis: 2 entries: Absent, n = 148; Present, n = 101 (1 missing)
- Valid: 2 levels: FALSE (n = 119); TRUE (n = 130) and missing (n = 1)
- Smoker: 2 levels: FALSE (n = 129); TRUE (n = 120) and missing (n = 1)
- Grade_Level: 3 entries: high, n = 104; low, n = 74; moderate, n = 71 (1 missing)
- DeathTime: 2 entries: Within1Year, n = 149; MoreThan1Year, n = 101
250 observations with 21 variables
18 variables containing missings (NA)
0 variables with no variance
Codes for defining variable types.19
print column names as vector
c("ID", "Name", "Sex", "Age", "Race", "PreinvasiveComponent",
"LVI", "PNI", "LastFollowUpDate", "Death", "Group", "Grade",
"TStage", "Anti-X-intensity", "Anti-Y-intensity", "LymphNodeMetastasis",
"Valid", "Smoker", "Grade_Level", "SurgeryDate", "DeathTime")
See the code as function in R/find_key.R.
keycolumns <- mydata %>% sapply(., FUN = dataMaid::isKey) %>% as_tibble() %>% select(which(.[1,
] == TRUE)) %>% names()
keycolumns[1] "ID" "Name"
Get variable types
# A tibble: 4 x 4
type cnt pcnt col_name
<chr> <int> <dbl> <list>
1 character 11 57.9 <chr [11]>
2 logical 3 15.8 <chr [3]>
3 numeric 3 15.8 <chr [3]>
4 POSIXct POSIXt 2 10.5 <chr [2]>
mydata %>% select(-keycolumns, -contains("Date")) %>% describer::describe() %>% knitr::kable(format = "markdown")| .column_name | .column_class | .column_type | .count_elements | .mean_value | .sd_value | .q0_value | .q25_value | .q50_value | .q75_value | .q100_value |
|---|---|---|---|---|---|---|---|---|---|---|
| Sex | character | character | 250 | NA | NA | Female | NA | NA | NA | Male |
| Age | numeric | double | 250 | 50.156627 | 14.1188634 | 25 | 39 | 51 | 63 | 73 |
| Race | character | character | 250 | NA | NA | Asian | NA | NA | NA | White |
| PreinvasiveComponent | character | character | 250 | NA | NA | Absent | NA | NA | NA | Present |
| LVI | character | character | 250 | NA | NA | Absent | NA | NA | NA | Present |
| PNI | character | character | 250 | NA | NA | Absent | NA | NA | NA | Present |
| Death | logical | logical | 250 | NA | NA | FALSE | NA | NA | NA | TRUE |
| Group | character | character | 250 | NA | NA | Control | NA | NA | NA | Treatment |
| Grade | character | character | 250 | NA | NA | 1 | NA | NA | NA | 3 |
| TStage | character | character | 250 | NA | NA | 1 | NA | NA | NA | 4 |
| Anti-X-intensity | numeric | double | 250 | 2.421687 | 0.6435878 | 1 | 2 | 3 | 3 | 3 |
| Anti-Y-intensity | numeric | double | 250 | 2.020080 | 0.7748559 | 1 | 1 | 2 | 3 | 3 |
| LymphNodeMetastasis | character | character | 250 | NA | NA | Absent | NA | NA | NA | Present |
| Valid | logical | logical | 250 | NA | NA | FALSE | NA | NA | NA | TRUE |
| Smoker | logical | logical | 250 | NA | NA | FALSE | NA | NA | NA | TRUE |
| Grade_Level | character | character | 250 | NA | NA | high | NA | NA | NA | moderate |
| DeathTime | character | character | 250 | NA | NA | MoreThan1Year | NA | NA | NA | Within1Year |
Plot variable types
# https://github.com/ropensci/visdat
# http://visdat.njtierney.com/articles/using_visdat.html
# https://cran.r-project.org/web/packages/visdat/index.html
# http://visdat.njtierney.com/
# visdat::vis_guess(mydata)
visdat::vis_dat(mydata)character variablescharacterVariables <- mydata %>% select(-keycolumns) %>% inspectdf::inspect_types() %>%
dplyr::filter(type == "character") %>% dplyr::select(col_name) %>% pull() %>%
unlist()
characterVariables [1] "Sex" "Race" "PreinvasiveComponent"
[4] "LVI" "PNI" "Group"
[7] "Grade" "TStage" "LymphNodeMetastasis"
[10] "Grade_Level" "DeathTime"
categorical variablescategoricalVariables <- mydata %>% dplyr::select(-keycolumns, -contains("Date")) %>%
describer::describe() %>% janitor::clean_names() %>% dplyr::filter(column_type ==
"factor") %>% dplyr::select(column_name) %>% dplyr::pull()
categoricalVariablescharacter(0)
continious variablescontiniousVariables <- mydata %>% dplyr::select(-keycolumns, -contains("Date")) %>%
describer::describe() %>% janitor::clean_names() %>% dplyr::filter(column_type ==
"numeric" | column_type == "double") %>% dplyr::select(column_name) %>% dplyr::pull()
continiousVariables[1] "Age" "Anti-X-intensity" "Anti-Y-intensity"
numeric variablesnumericVariables <- mydata %>% select(-keycolumns) %>% inspectdf::inspect_types() %>%
dplyr::filter(type == "numeric") %>% dplyr::select(col_name) %>% pull() %>% unlist()
numericVariables[1] "Age" "Anti-X-intensity" "Anti-Y-intensity"
integer variablesintegerVariables <- mydata %>% select(-keycolumns) %>% inspectdf::inspect_types() %>%
dplyr::filter(type == "integer") %>% dplyr::select(col_name) %>% pull() %>% unlist()
integerVariablesNULL
Codes for overviewing the data.20
reactable::reactable(data = mydata, sortable = TRUE, resizable = TRUE, filterable = TRUE,
searchable = TRUE, pagination = TRUE, paginationType = "numbers", showPageSizeOptions = TRUE,
highlight = TRUE, striped = TRUE, outlined = TRUE, compact = TRUE, wrap = FALSE,
showSortIcon = TRUE, showSortable = TRUE)Summary of Data via summarytools 📦
if (!dir.exists(here::here("out"))) {
dir.create(here::here("out"))
}
summarytools::view(x = summarytools::dfSummary(mydata %>% select(-keycolumns)), file = here::here("out",
"mydata_summary.html"))Summary via dataMaid 📦
if (!dir.exists(here::here("out"))) {
dir.create(here::here("out"))
}
dataMaid::makeDataReport(data = mydata, file = here::here("out", "dataMaid_mydata.Rmd"),
replace = TRUE, openResult = FALSE, render = FALSE, quiet = TRUE)Summary via explore 📦
if (!dir.exists(here::here("out"))) {
dir.create(here::here("out"))
}
mydata %>% select(-dateVariables) %>% explore::report(output_file = "mydata_report.html",
output_dir = here::here("out"))Glimpse of Data
Observations: 250
Variables: 17
$ Sex <chr> "Female", "Female", "Female", "Male", "Male", "F…
$ Age <dbl> 33, 43, 47, 68, 53, 51, 56, 47, 55, 36, 68, 68, …
$ Race <chr> "White", "White", "Black", "Asian", "Hispanic", …
$ PreinvasiveComponent <chr> "Absent", "Absent", "Absent", "Absent", "Present…
$ LVI <chr> "Absent", "Absent", "Present", "Absent", "Absent…
$ PNI <chr> "Present", "Present", "Absent", "Present", "Pres…
$ Death <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE,…
$ Group <chr> "Treatment", "Control", "Control", "Control", "T…
$ Grade <chr> "1", "3", "1", "3", "3", "3", "3", "3", "2", "3"…
$ TStage <chr> "2", "2", "4", "2", "4", "3", "4", "4", "1", "3"…
$ `Anti-X-intensity` <dbl> 2, 1, 3, 2, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 3, …
$ `Anti-Y-intensity` <dbl> 3, 3, 2, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 3, …
$ LymphNodeMetastasis <chr> "Absent", "Absent", "Present", "Absent", "Absent…
$ Valid <lgl> TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FAL…
$ Smoker <lgl> FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FA…
$ Grade_Level <chr> "moderate", "high", "moderate", "low", "moderate…
$ DeathTime <chr> "Within1Year", "Within1Year", "Within1Year", "Wi…
variable type na na_pct unique min mean max
1 ID chr 0 0.0 250 NA NA NA
2 Name chr 1 0.4 250 NA NA NA
3 Sex chr 1 0.4 3 NA NA NA
4 Age dbl 1 0.4 50 25 50.16 73
5 Race chr 1 0.4 7 NA NA NA
6 PreinvasiveComponent chr 1 0.4 3 NA NA NA
7 LVI chr 0 0.0 2 NA NA NA
8 PNI chr 1 0.4 3 NA NA NA
9 LastFollowUpDate dat 1 0.4 13 NA NA NA
10 Death lgl 1 0.4 3 0 0.72 1
11 Group chr 1 0.4 3 NA NA NA
12 Grade chr 1 0.4 4 NA NA NA
13 TStage chr 1 0.4 5 NA NA NA
14 Anti-X-intensity dbl 1 0.4 4 1 2.42 3
15 Anti-Y-intensity dbl 1 0.4 4 1 2.02 3
16 LymphNodeMetastasis chr 1 0.4 3 NA NA NA
17 Valid lgl 1 0.4 3 0 0.52 1
18 Smoker lgl 1 0.4 3 0 0.48 1
19 Grade_Level chr 1 0.4 4 NA NA NA
20 SurgeryDate dat 1 0.4 221 NA NA NA
21 DeathTime chr 0 0.0 2 NA NA NA
Explore
Control Data if matching expectations
visdat::vis_expect(data = mydata, expectation = ~.x == -1, show_perc = TRUE)
visdat::vis_expect(mydata, ~.x >= 25)See missing values
$variables
Variable q qNA pNA qZero pZero qBlank pBlank qInf pInf
1 Smoker 250 1 0.4% 129 51.6% 0 - 0 -
2 Valid 250 1 0.4% 119 47.6% 0 - 0 -
3 Death 250 1 0.4% 70 28% 0 - 0 -
4 Sex 250 1 0.4% 0 - 0 - 0 -
5 PreinvasiveComponent 250 1 0.4% 0 - 0 - 0 -
6 PNI 250 1 0.4% 0 - 0 - 0 -
7 Group 250 1 0.4% 0 - 0 - 0 -
8 LymphNodeMetastasis 250 1 0.4% 0 - 0 - 0 -
9 Grade 250 1 0.4% 0 - 0 - 0 -
10 Anti-X-intensity 250 1 0.4% 0 - 0 - 0 -
11 Anti-Y-intensity 250 1 0.4% 0 - 0 - 0 -
12 Grade_Level 250 1 0.4% 0 - 0 - 0 -
13 TStage 250 1 0.4% 0 - 0 - 0 -
14 Race 250 1 0.4% 0 - 0 - 0 -
15 LastFollowUpDate 250 1 0.4% 0 - 0 - 0 -
16 Age 250 1 0.4% 0 - 0 - 0 -
17 SurgeryDate 250 1 0.4% 0 - 0 - 0 -
18 Name 250 1 0.4% 0 - 0 - 0 -
19 LVI 250 0 - 0 - 0 - 0 -
20 DeathTime 250 0 - 0 - 0 - 0 -
21 ID 250 0 - 0 - 0 - 0 -
qDistinct type anomalous_percent
1 3 Logical 52%
2 3 Logical 48%
3 3 Logical 28.4%
4 3 Character 0.4%
5 3 Character 0.4%
6 3 Character 0.4%
7 3 Character 0.4%
8 3 Character 0.4%
9 4 Character 0.4%
10 4 Numeric 0.4%
11 4 Numeric 0.4%
12 4 Character 0.4%
13 5 Character 0.4%
14 7 Character 0.4%
15 13 Timestamp 0.4%
16 50 Numeric 0.4%
17 221 Timestamp 0.4%
18 250 Character 0.4%
19 2 Character -
20 2 Character -
21 250 Character -
$problem_variables
[1] Variable q qNA pNA
[5] qZero pZero qBlank pBlank
[9] qInf pInf qDistinct type
[13] anomalous_percent problems
<0 rows> (or 0-length row.names)
================================================================================
[1] "Ignoring variable LastFollowUpDate: Unsupported type for visualization."
[1] "Ignoring variable SurgeryDate: Unsupported type for visualization."
Variable p_1 p_10 p_25 p_50 p_75 p_90 p_99
1 Anti-X-intensity 1 2 2 3 3 3 3
2 Anti-Y-intensity 1 1 1 2 3 3 3
3 Age 25 30.8 39 51 63 69 72
Summary of Data via DataExplorer 📦
# A tibble: 1 x 9
rows columns discrete_columns continuous_colu… all_missing_col…
<int> <int> <int> <int> <int>
1 250 21 18 3 0
# … with 4 more variables: total_missing_values <int>, complete_rows <int>,
# total_observations <int>, memory_usage <dbl>
Drop columns
Write results as described in (Knijn, Simmer, and Nagtegaal 2015)22
Describe the number of patients included in the analysis and reason for dropout
Report patient/disease characteristics (including the biomarker of interest) with the number of missing values
Describe the interaction of the biomarker of interest with established prognostic variables
Include at least 90 % of initial cases included in univariate and multivariate analyses
Report the estimated effect (relative risk/odds ratio, confidence interval, and p value) in univariate analysis
Report the estimated effect (hazard rate/odds ratio, confidence interval, and p value) in multivariate analysis
Report the estimated effects (hazard ratio/odds ratio, confidence interval, and p value) of other prognostic factors included in multivariate analysis
Codes for Descriptive Statistics.23
Report Data properties via report 📦
The data contains 250 observations of the following variables:
- ID: 250 entries: 001, n = 1; 002, n = 1; 003, n = 1 and 247 others
- Name: 249 entries: Adiya, n = 1; Ahlani, n = 1; Ahlaysia, n = 1 and 246 others (1 missing)
- Sex: 2 entries: Female, n = 134; Male, n = 115 (1 missing)
- Age: Mean = 50.16, SD = 14.12, range = [25, 73], 1 missing
- Race: 6 entries: White, n = 158; Hispanic, n = 37; Black, n = 28 and 3 others (1 missing)
- PreinvasiveComponent: 2 entries: Absent, n = 201; Present, n = 48 (1 missing)
- LVI: 2 entries: Absent, n = 152; Present, n = 98
- PNI: 2 entries: Absent, n = 171; Present, n = 78 (1 missing)
- Death: 2 levels: FALSE (n = 70); TRUE (n = 179) and missing (n = 1)
- Group: 2 entries: Treatment, n = 127; Control, n = 122 (1 missing)
- Grade: 3 entries: 3, n = 105; 1, n = 79; 2, n = 65 (1 missing)
- TStage: 4 entries: 4, n = 109; 3, n = 62; 2, n = 51 and 1 other (1 missing)
- Anti-X-intensity: Mean = 2.42, SD = 0.64, range = [1, 3], 1 missing
- Anti-Y-intensity: Mean = 2.02, SD = 0.77, range = [1, 3], 1 missing
- LymphNodeMetastasis: 2 entries: Absent, n = 148; Present, n = 101 (1 missing)
- Valid: 2 levels: FALSE (n = 119); TRUE (n = 130) and missing (n = 1)
- Smoker: 2 levels: FALSE (n = 129); TRUE (n = 120) and missing (n = 1)
- Grade_Level: 3 entries: high, n = 104; low, n = 74; moderate, n = 71 (1 missing)
- DeathTime: 2 entries: Within1Year, n = 149; MoreThan1Year, n = 101
Table 1 via arsenal 📦
# cat(names(mydata), sep = ' + \n')
library(arsenal)
tab1 <- arsenal::tableby(~Sex + Age + Race + PreinvasiveComponent + LVI + PNI + Death +
Group + Grade + TStage + `Anti-X-intensity` + `Anti-Y-intensity` + LymphNodeMetastasis +
Valid + Smoker + Grade_Level, data = mydata)
summary(tab1)| Overall (N=250) | |
|---|---|
| Sex | |
| N-Miss | 1 |
| Female | 134 (53.8%) |
| Male | 115 (46.2%) |
| Age | |
| N-Miss | 1 |
| Mean (SD) | 50.157 (14.119) |
| Range | 25.000 - 73.000 |
| Race | |
| N-Miss | 1 |
| Asian | 16 (6.4%) |
| Bi-Racial | 5 (2.0%) |
| Black | 28 (11.2%) |
| Hispanic | 37 (14.9%) |
| Native | 5 (2.0%) |
| White | 158 (63.5%) |
| PreinvasiveComponent | |
| N-Miss | 1 |
| Absent | 201 (80.7%) |
| Present | 48 (19.3%) |
| LVI | |
| Absent | 152 (60.8%) |
| Present | 98 (39.2%) |
| PNI | |
| N-Miss | 1 |
| Absent | 171 (68.7%) |
| Present | 78 (31.3%) |
| Death | |
| N-Miss | 1 |
| FALSE | 70 (28.1%) |
| TRUE | 179 (71.9%) |
| Group | |
| N-Miss | 1 |
| Control | 122 (49.0%) |
| Treatment | 127 (51.0%) |
| Grade | |
| N-Miss | 1 |
| 1 | 79 (31.7%) |
| 2 | 65 (26.1%) |
| 3 | 105 (42.2%) |
| TStage | |
| N-Miss | 1 |
| 1 | 27 (10.8%) |
| 2 | 51 (20.5%) |
| 3 | 62 (24.9%) |
| 4 | 109 (43.8%) |
| Anti-X-intensity | |
| N-Miss | 1 |
| Mean (SD) | 2.422 (0.644) |
| Range | 1.000 - 3.000 |
| Anti-Y-intensity | |
| N-Miss | 1 |
| Mean (SD) | 2.020 (0.775) |
| Range | 1.000 - 3.000 |
| LymphNodeMetastasis | |
| N-Miss | 1 |
| Absent | 148 (59.4%) |
| Present | 101 (40.6%) |
| Valid | |
| N-Miss | 1 |
| FALSE | 119 (47.8%) |
| TRUE | 130 (52.2%) |
| Smoker | |
| N-Miss | 1 |
| FALSE | 129 (51.8%) |
| TRUE | 120 (48.2%) |
| Grade_Level | |
| N-Miss | 1 |
| high | 104 (41.8%) |
| low | 74 (29.7%) |
| moderate | 71 (28.5%) |
Table 1 via tableone 📦
library(tableone)
mydata %>% select(-keycolumns, -dateVariables) %>% tableone::CreateTableOne(data = .)
Overall
n 250
Sex = Male (%) 115 (46.2)
Age (mean (SD)) 50.16 (14.12)
Race (%)
Asian 16 ( 6.4)
Bi-Racial 5 ( 2.0)
Black 28 (11.2)
Hispanic 37 (14.9)
Native 5 ( 2.0)
White 158 (63.5)
PreinvasiveComponent = Present (%) 48 (19.3)
LVI = Present (%) 98 (39.2)
PNI = Present (%) 78 (31.3)
Death = TRUE (%) 179 (71.9)
Group = Treatment (%) 127 (51.0)
Grade (%)
1 79 (31.7)
2 65 (26.1)
3 105 (42.2)
TStage (%)
1 27 (10.8)
2 51 (20.5)
3 62 (24.9)
4 109 (43.8)
Anti-X-intensity (mean (SD)) 2.42 (0.64)
Anti-Y-intensity (mean (SD)) 2.02 (0.77)
LymphNodeMetastasis = Present (%) 101 (40.6)
Valid = TRUE (%) 130 (52.2)
Smoker = TRUE (%) 120 (48.2)
Grade_Level (%)
high 104 (41.8)
low 74 (29.7)
moderate 71 (28.5)
DeathTime = Within1Year (%) 149 (59.6)
Descriptive Statistics of Continuous Variables
mydata %>% select(continiousVariables, numericVariables, integerVariables) %>% summarytools::descr(.,
style = "rmarkdown") variable type na na_pct unique min mean max
1 Sex chr 1 0.4 3 NA NA NA
2 PreinvasiveComponent chr 1 0.4 3 NA NA NA
3 LVI chr 0 0.0 2 NA NA NA
4 PNI chr 1 0.4 3 NA NA NA
5 Death lgl 1 0.4 3 0 0.72 1
6 Group chr 1 0.4 3 NA NA NA
7 Grade chr 1 0.4 4 NA NA NA
8 Anti-X-intensity dbl 1 0.4 4 1 2.42 3
9 Anti-Y-intensity dbl 1 0.4 4 1 2.02 3
10 LymphNodeMetastasis chr 1 0.4 3 NA NA NA
11 Valid lgl 1 0.4 3 0 0.52 1
12 Smoker lgl 1 0.4 3 0 0.48 1
13 Grade_Level chr 1 0.4 4 NA NA NA
14 DeathTime chr 0 0.0 2 NA NA NA
variable type na na_pct unique min mean max
1 Name chr 1 0.4 250 NA NA NA
2 Sex chr 1 0.4 3 NA NA NA
3 Age dbl 1 0.4 50 25 50.16 73
4 Race chr 1 0.4 7 NA NA NA
5 PreinvasiveComponent chr 1 0.4 3 NA NA NA
6 PNI chr 1 0.4 3 NA NA NA
7 LastFollowUpDate dat 1 0.4 13 NA NA NA
8 Death lgl 1 0.4 3 0 0.72 1
9 Group chr 1 0.4 3 NA NA NA
10 Grade chr 1 0.4 4 NA NA NA
11 TStage chr 1 0.4 5 NA NA NA
12 Anti-X-intensity dbl 1 0.4 4 1 2.42 3
13 Anti-Y-intensity dbl 1 0.4 4 1 2.02 3
14 LymphNodeMetastasis chr 1 0.4 3 NA NA NA
15 Valid lgl 1 0.4 3 0 0.52 1
16 Smoker lgl 1 0.4 3 0 0.48 1
17 Grade_Level chr 1 0.4 4 NA NA NA
18 SurgeryDate dat 1 0.4 221 NA NA NA
variable type na na_pct unique min mean max
1 ID chr 0 0.0 250 NA NA NA
2 Name chr 1 0.4 250 NA NA NA
3 Sex chr 1 0.4 3 NA NA NA
4 Age dbl 1 0.4 50 25 50.16 73
5 Race chr 1 0.4 7 NA NA NA
6 PreinvasiveComponent chr 1 0.4 3 NA NA NA
7 LVI chr 0 0.0 2 NA NA NA
8 PNI chr 1 0.4 3 NA NA NA
9 LastFollowUpDate dat 1 0.4 13 NA NA NA
10 Death lgl 1 0.4 3 0 0.72 1
11 Group chr 1 0.4 3 NA NA NA
12 Grade chr 1 0.4 4 NA NA NA
13 TStage chr 1 0.4 5 NA NA NA
14 Anti-X-intensity dbl 1 0.4 4 1 2.42 3
15 Anti-Y-intensity dbl 1 0.4 4 1 2.02 3
16 LymphNodeMetastasis chr 1 0.4 3 NA NA NA
17 Valid lgl 1 0.4 3 0 0.52 1
18 Smoker lgl 1 0.4 3 0 0.48 1
19 Grade_Level chr 1 0.4 4 NA NA NA
20 SurgeryDate dat 1 0.4 221 NA NA NA
21 DeathTime chr 0 0.0 2 NA NA NA
Use R/gc_desc_cat.R to generate gc_desc_cat.Rmd containing descriptive statistics for categorical variables
mydata %>% janitor::tabyl(Sex) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| Sex | n | percent | valid_percent |
|---|---|---|---|
| Female | 134 | 53.6% | 53.8% |
| Male | 115 | 46.0% | 46.2% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(Race) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| Race | n | percent | valid_percent |
|---|---|---|---|
| Asian | 16 | 6.4% | 6.4% |
| Bi-Racial | 5 | 2.0% | 2.0% |
| Black | 28 | 11.2% | 11.2% |
| Hispanic | 37 | 14.8% | 14.9% |
| Native | 5 | 2.0% | 2.0% |
| White | 158 | 63.2% | 63.5% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(PreinvasiveComponent) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| PreinvasiveComponent | n | percent | valid_percent |
|---|---|---|---|
| Absent | 201 | 80.4% | 80.7% |
| Present | 48 | 19.2% | 19.3% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(LVI) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| LVI | n | percent |
|---|---|---|
| Absent | 152 | 60.8% |
| Present | 98 | 39.2% |
mydata %>% janitor::tabyl(PNI) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| PNI | n | percent | valid_percent |
|---|---|---|---|
| Absent | 171 | 68.4% | 68.7% |
| Present | 78 | 31.2% | 31.3% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(Group) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| Group | n | percent | valid_percent |
|---|---|---|---|
| Control | 122 | 48.8% | 49.0% |
| Treatment | 127 | 50.8% | 51.0% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(Grade) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| Grade | n | percent | valid_percent |
|---|---|---|---|
| 1 | 79 | 31.6% | 31.7% |
| 2 | 65 | 26.0% | 26.1% |
| 3 | 105 | 42.0% | 42.2% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(TStage) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| TStage | n | percent | valid_percent |
|---|---|---|---|
| 1 | 27 | 10.8% | 10.8% |
| 2 | 51 | 20.4% | 20.5% |
| 3 | 62 | 24.8% | 24.9% |
| 4 | 109 | 43.6% | 43.8% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(LymphNodeMetastasis) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| LymphNodeMetastasis | n | percent | valid_percent |
|---|---|---|---|
| Absent | 148 | 59.2% | 59.4% |
| Present | 101 | 40.4% | 40.6% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(Grade_Level) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| Grade_Level | n | percent | valid_percent |
|---|---|---|---|
| high | 104 | 41.6% | 41.8% |
| low | 74 | 29.6% | 29.7% |
| moderate | 71 | 28.4% | 28.5% |
| NA | 1 | 0.4% | - |
mydata %>% janitor::tabyl(DeathTime) %>% janitor::adorn_pct_formatting(rounding = "half up",
digits = 1) %>% knitr::kable()| DeathTime | n | percent |
|---|---|---|
| MoreThan1Year | 101 | 40.4% |
| Within1Year | 149 | 59.6% |
race_stats <- summarytools::freq(mydata$Race)
print(race_stats, report.nas = FALSE, totals = FALSE, display.type = FALSE, Variable.label = "Race Group")variable = PreinvasiveComponent
type = character
na = 1 of 250 (0.4%)
unique = 3
Absent = 201 (80.4%)
Present = 48 (19.2%)
NA = 1 (0.4%)
## Frequency or custom tables for categorical variables
SmartEDA::ExpCTable(mydata, Target = NULL, margin = 1, clim = 10, nlim = 5, round = 2,
bin = NULL, per = T) Variable Valid Frequency Percent CumPercent
1 Sex Female 134 53.6 53.6
2 Sex Male 115 46.0 99.6
3 Sex NA 1 0.4 100.0
4 Sex TOTAL 250 NA NA
5 Race Asian 16 6.4 6.4
6 Race Bi-Racial 5 2.0 8.4
7 Race Black 28 11.2 19.6
8 Race Hispanic 37 14.8 34.4
9 Race NA 1 0.4 34.8
10 Race Native 5 2.0 36.8
11 Race White 158 63.2 100.0
12 Race TOTAL 250 NA NA
13 PreinvasiveComponent Absent 201 80.4 80.4
14 PreinvasiveComponent NA 1 0.4 80.8
15 PreinvasiveComponent Present 48 19.2 100.0
16 PreinvasiveComponent TOTAL 250 NA NA
17 LVI Absent 152 60.8 60.8
18 LVI Present 98 39.2 100.0
19 LVI TOTAL 250 NA NA
20 PNI Absent 171 68.4 68.4
21 PNI NA 1 0.4 68.8
22 PNI Present 78 31.2 100.0
23 PNI TOTAL 250 NA NA
24 Group Control 122 48.8 48.8
25 Group NA 1 0.4 49.2
26 Group Treatment 127 50.8 100.0
27 Group TOTAL 250 NA NA
28 Grade 1 79 31.6 31.6
29 Grade 2 65 26.0 57.6
30 Grade 3 105 42.0 99.6
31 Grade NA 1 0.4 100.0
32 Grade TOTAL 250 NA NA
33 TStage 1 27 10.8 10.8
34 TStage 2 51 20.4 31.2
35 TStage 3 62 24.8 56.0
36 TStage 4 109 43.6 99.6
37 TStage NA 1 0.4 100.0
38 TStage TOTAL 250 NA NA
39 LymphNodeMetastasis Absent 148 59.2 59.2
40 LymphNodeMetastasis NA 1 0.4 59.6
41 LymphNodeMetastasis Present 101 40.4 100.0
42 LymphNodeMetastasis TOTAL 250 NA NA
43 Grade_Level high 104 41.6 41.6
44 Grade_Level low 74 29.6 71.2
45 Grade_Level moderate 71 28.4 99.6
46 Grade_Level NA 1 0.4 100.0
47 Grade_Level TOTAL 250 NA NA
48 DeathTime MoreThan1Year 101 40.4 40.4
49 DeathTime Within1Year 149 59.6 100.0
50 DeathTime TOTAL 250 NA NA
51 Anti-X-intensity 1 21 8.4 8.4
52 Anti-X-intensity 2 102 40.8 49.2
53 Anti-X-intensity 3 126 50.4 99.6
54 Anti-X-intensity NA 1 0.4 100.0
55 Anti-X-intensity TOTAL 250 NA NA
56 Anti-Y-intensity 1 72 28.8 28.8
57 Anti-Y-intensity 2 100 40.0 68.8
58 Anti-Y-intensity 3 77 30.8 99.6
59 Anti-Y-intensity NA 1 0.4 100.0
60 Anti-Y-intensity TOTAL 250 NA NA
# A tibble: 16 x 5
col_name cnt common common_pcnt levels
<chr> <int> <chr> <dbl> <named list>
1 Death 3 TRUE 71.6 <tibble [3 × 3]>
2 DeathTime 2 Within1Year 59.6 <tibble [2 × 3]>
3 Grade 4 3 42 <tibble [4 × 3]>
4 Grade_Level 4 high 41.6 <tibble [4 × 3]>
5 Group 3 Treatment 50.8 <tibble [3 × 3]>
6 ID 250 001 0.4 <tibble [250 × 3]>
7 LVI 2 Absent 60.8 <tibble [2 × 3]>
8 LymphNodeMetastasis 3 Absent 59.2 <tibble [3 × 3]>
9 Name 250 Adiya 0.4 <tibble [250 × 3]>
10 PNI 3 Absent 68.4 <tibble [3 × 3]>
11 PreinvasiveComponent 3 Absent 80.4 <tibble [3 × 3]>
12 Race 7 White 63.2 <tibble [7 × 3]>
13 Sex 3 Female 53.6 <tibble [3 × 3]>
14 Smoker 3 FALSE 51.6 <tibble [3 × 3]>
15 TStage 5 4 43.6 <tibble [5 × 3]>
16 Valid 3 TRUE 52 <tibble [3 × 3]>
# A tibble: 3 x 3
value prop cnt
<chr> <dbl> <int>
1 Treatment 0.508 127
2 Control 0.488 122
3 <NA> 0.004 1
summarytools::stby(list(x = mydata$LVI, y = mydata$LymphNodeMetastasis), mydata$PNI,
summarytools::ctable)SmartEDA::ExpCTable(mydata, Target = "Sex", margin = 1, clim = 10, nlim = NULL, round = 2,
bin = 4, per = F) VARIABLE CATEGORY Sex:Female Sex:Male Sex:NA TOTAL
1 Race Asian 9 7 0 16
2 Race Bi-Racial 3 2 0 5
3 Race Black 21 7 0 28
4 Race Hispanic 19 18 0 37
5 Race NA 0 1 0 1
6 Race Native 4 1 0 5
7 Race White 78 79 1 158
8 Race TOTAL 134 115 1 250
9 PreinvasiveComponent Absent 108 92 1 201
10 PreinvasiveComponent NA 1 0 0 1
11 PreinvasiveComponent Present 25 23 0 48
12 PreinvasiveComponent TOTAL 134 115 1 250
13 LVI Absent 77 74 1 152
14 LVI Present 57 41 0 98
15 LVI TOTAL 134 115 1 250
16 PNI Absent 98 73 0 171
17 PNI NA 0 1 0 1
18 PNI Present 36 41 1 78
19 PNI TOTAL 134 115 1 250
20 Group Control 70 52 0 122
21 Group NA 0 1 0 1
22 Group Treatment 64 62 1 127
23 Group TOTAL 134 115 1 250
24 Grade 1 46 32 1 79
25 Grade 2 35 30 0 65
26 Grade 3 52 53 0 105
27 Grade NA 1 0 0 1
28 Grade TOTAL 134 115 1 250
29 TStage 1 16 11 0 27
30 TStage 2 29 21 1 51
31 TStage 3 32 30 0 62
32 TStage 4 57 52 0 109
33 TStage NA 0 1 0 1
34 TStage TOTAL 134 115 1 250
35 LymphNodeMetastasis Absent 80 68 0 148
36 LymphNodeMetastasis NA 1 0 0 1
37 LymphNodeMetastasis Present 53 47 1 101
38 LymphNodeMetastasis TOTAL 134 115 1 250
39 Grade_Level high 61 43 0 104
40 Grade_Level low 42 31 1 74
41 Grade_Level moderate 31 40 0 71
42 Grade_Level NA 0 1 0 1
43 Grade_Level TOTAL 134 115 1 250
44 DeathTime MoreThan1Year 53 47 1 101
45 DeathTime Within1Year 81 68 0 149
46 DeathTime TOTAL 134 115 1 250
47 Anti-X-intensity 1 12 9 0 21
48 Anti-X-intensity 2 53 48 1 102
49 Anti-X-intensity 3 69 57 0 126
50 Anti-X-intensity NA 0 1 0 1
51 Anti-X-intensity TOTAL 134 115 1 250
52 Anti-Y-intensity 1 40 32 0 72
53 Anti-Y-intensity 2 56 44 0 100
54 Anti-Y-intensity 3 38 38 1 77
55 Anti-Y-intensity NA 0 1 0 1
56 Anti-Y-intensity TOTAL 134 115 1 250
mydata %>% select(characterVariables) %>% select(PreinvasiveComponent, PNI, LVI) %>%
reactable::reactable(data = ., groupBy = c("PreinvasiveComponent", "PNI"), columns = list(LVI = reactable::colDef(aggregate = "count")))Descriptive Statistics Age
mydata %>% jmv::descriptives(data = ., vars = "Age", hist = TRUE, dens = TRUE, box = TRUE,
violin = TRUE, dot = TRUE, mode = TRUE, sd = TRUE, variance = TRUE, skew = TRUE,
kurt = TRUE, quart = TRUE)
DESCRIPTIVES
Descriptives
──────────────────────────────────
Age
──────────────────────────────────
N 249
Missing 1
Mean 50.2
Median 51.0
Mode 63.0
Standard deviation 14.1
Variance 199
Minimum 25.0
Maximum 73.0
Skewness -0.0947
Std. error skewness 0.154
Kurtosis -1.21
Std. error kurtosis 0.307
25th percentile 39.0
50th percentile 51.0
75th percentile 63.0
──────────────────────────────────
Descriptive Statistics Anti-X-intensity
mydata %>% jmv::descriptives(data = ., vars = "Anti-X-intensity", hist = TRUE, dens = TRUE,
box = TRUE, violin = TRUE, dot = TRUE, mode = TRUE, sd = TRUE, variance = TRUE,
skew = TRUE, kurt = TRUE, quart = TRUE)
DESCRIPTIVES
Descriptives
───────────────────────────────────────────
Anti-X-intensity
───────────────────────────────────────────
N 249
Missing 1
Mean 2.42
Median 3.00
Mode 3.00
Standard deviation 0.644
Variance 0.414
Minimum 1.00
Maximum 3.00
Skewness -0.665
Std. error skewness 0.154
Kurtosis -0.554
Std. error kurtosis 0.307
25th percentile 2.00
50th percentile 3.00
75th percentile 3.00
───────────────────────────────────────────
Descriptive Statistics Anti-Y-intensity
mydata %>% jmv::descriptives(data = ., vars = "Anti-Y-intensity", hist = TRUE, dens = TRUE,
box = TRUE, violin = TRUE, dot = TRUE, mode = TRUE, sd = TRUE, variance = TRUE,
skew = TRUE, kurt = TRUE, quart = TRUE)
DESCRIPTIVES
Descriptives
───────────────────────────────────────────
Anti-Y-intensity
───────────────────────────────────────────
N 249
Missing 1
Mean 2.02
Median 2.00
Mode 2.00
Standard deviation 0.775
Variance 0.600
Minimum 1.00
Maximum 3.00
Skewness -0.0347
Std. error skewness 0.154
Kurtosis -1.33
Std. error kurtosis 0.307
25th percentile 1.00
50th percentile 2.00
75th percentile 3.00
───────────────────────────────────────────
Overall
n 250
Age (mean (SD)) 50.16 (14.12)
Anti-X-intensity (mean (SD)) 2.42 (0.64)
Anti-Y-intensity (mean (SD)) 2.02 (0.77)
Overall
n 250
Age (mean (SD)) 50.16 (14.12)
Anti-X-intensity (median [IQR]) 3.00 [2.00, 3.00]
Anti-Y-intensity (mean (SD)) 2.02 (0.77)
variable = Age
type = double
na = 1 of 250 (0.4%)
unique = 50
min|max = 25 | 73
q05|q95 = 27 | 71
q25|q75 = 39 | 63
median = 51
mean = 50.15663
mydata %>% select(continiousVariables) %>% SmartEDA::ExpNumStat(data = ., by = "A",
gp = NULL, Qnt = seq(0, 1, 0.1), MesofShape = 2, Outlier = TRUE, round = 2)# A tibble: 3 x 10
col_name min q1 median mean q3 max sd pcnt_na hist
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <named list>
1 Age 25 39 51 50.2 63 73 14.1 0.4 <tibble [12…
2 Anti-X-inten… 1 2 3 2.42 3 3 0.644 0.4 <tibble [12…
3 Anti-Y-inten… 1 1 2 2.02 3 3 0.775 0.4 <tibble [12…
# A tibble: 27 x 2
value prop
<chr> <dbl>
1 [-Inf, 24) 0
2 [24, 26) 0.0281
3 [26, 28) 0.0321
4 [28, 30) 0.0201
5 [30, 32) 0.0402
6 [32, 34) 0.0361
7 [34, 36) 0.0241
8 [36, 38) 0.0402
9 [38, 40) 0.0562
10 [40, 42) 0.0522
# … with 17 more rows
summarytools::stby(data = mydata, INDICES = mydata$PreinvasiveComponent, FUN = summarytools::descr,
stats = c("mean", "sd", "min", "med", "max"), transpose = TRUE)with(mydata, summarytools::stby(Age, PreinvasiveComponent, summarytools::descr),
stats = c("mean", "sd", "min", "med", "max"), transpose = TRUE)## Summary statistics by – category
SmartEDA::ExpNumStat(mydata, by = "GA", gp = "PreinvasiveComponent", Qnt = seq(0,
1, 0.1), MesofShape = 2, Outlier = TRUE, round = 2) Vname Group TN nNeg nZero nPos NegInf PosInf NA_Value
1 Age PreinvasiveComponent:All 250 0 0 249 0 0 1
2 Age PreinvasiveComponent:Absent 201 0 0 201 0 0 0
3 Age PreinvasiveComponent:Present 48 0 0 48 0 0 0
4 Age PreinvasiveComponent:NA 0 0 0 0 0 0 0
Per_of_Missing sum min max mean median SD CV IQR Skewness Kurtosis
1 0.4 12489 25 73 50.16 51 14.12 0.28 24.00 -0.09 -1.21
2 0.0 10057 25 73 50.03 51 14.22 0.28 25.00 -0.11 -1.21
3 0.0 2432 25 73 50.67 51 13.84 0.27 26.25 -0.03 -1.23
4 NaN 0 Inf -Inf NaN NA NA NA NA NaN NaN
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% LB.25% UB.75% nOutliers
1 25 30.8 37.0 40.0 45.2 51 55.0 61.0 65.0 69 73 3.00 99.00 0
2 25 30.0 36.0 40.0 46.0 51 55.0 61.0 65.0 69 73 0.50 100.50 0
3 25 33.1 38.4 41.1 45.0 51 54.2 59.8 66.6 69 73 -0.38 104.62 0
4 NA NA NA NA NA NA NA NA NA NA NA NA NA 0
Codes for Survival Analysis24
https://link.springer.com/article/10.1007/s00701-019-04096-9
Calculate survival time
mydata$int <- lubridate::interval(lubridate::ymd(mydata$SurgeryDate), lubridate::ymd(mydata$LastFollowUpDate))
mydata$OverallTime <- lubridate::time_length(mydata$int, "month")
mydata$OverallTime <- round(mydata$OverallTime, digits = 1)recode death status outcome as numbers for survival analysis
## Recoding mydata$Death into mydata$Outcome
mydata$Outcome <- forcats::fct_recode(as.character(mydata$Death), `1` = "TRUE", `0` = "FALSE")
mydata$Outcome <- as.numeric(as.character(mydata$Outcome))it is always a good practice to double-check after recoding25
0 1
FALSE 70 0
TRUE 0 179
library(survival)
# data(lung) km <- with(lung, Surv(time, status))
km <- with(mydata, Surv(OverallTime, Outcome))
head(km, 80) [1] 9.8 11.4 4.4 4.7 10.1 7.8 7.7 7.6+ 8.4+ 11.4 6.9+ 6.7
[13] 3.0 4.0 11.7+ 3.9+ 7.1 11.3 11.3+ 5.4 5.9+ 3.7 9.3 11.3
[25] 4.5 8.4 9.1 8.2+ 4.5 11.0 9.9 7.7 3.7+ 4.0 10.8+ 3.1
[37] 10.6 7.3+ 5.4 3.8 9.6+ 5.8 4.5+ 5.9 10.3 8.6 11.6 4.7
[49] 4.3 11.5 6.0 9.8 6.9 10.0 3.7+ 4.2 10.1+ 8.1 5.7 10.5+
[61] 9.9+ 6.7 3.2 11.0+ 4.5 4.6 8.0 8.1 9.3+ 5.7+ 11.5+ 8.3+
[73] 5.3+ 6.0+ 10.7 7.3 4.6 5.1+ 8.8+ 11.2
Kaplan-Meier Plot Log-Rank Test
# Drawing Survival Curves Using ggplot2
# https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html
dependentKM <- "Surv(OverallTime, Outcome)"
explanatoryKM <- "LVI"
mydata %>%
finalfit::surv_plot(.data = .,
dependent = dependentKM,
explanatory = explanatoryKM,
xlab='Time (months)',
pval=TRUE,
legend = 'none',
break.time.by = 12,
xlim = c(0,60)
# legend.labs = c('a','b')
)# Drawing Survival Curves Using ggplot2
# https://rpkgs.datanovia.com/survminer/reference/ggsurvplot.html
mydata %>%
finalfit::surv_plot(.data = .,
dependent = "Surv(OverallTime, Outcome)",
explanatory = "LVI",
xlab='Time (months)',
pval=TRUE,
legend = 'none',
break.time.by = 12,
xlim = c(0,60)
# legend.labs = c('a','b')
)library(finalfit)
library(survival)
explanatoryUni <- "LVI"
dependentUni <- "Surv(OverallTime, Outcome)"
tUni <- mydata %>% finalfit::finalfit(dependentUni, explanatoryUni)
knitr::kable(tUni, row.names = FALSE, align = c("l", "l", "r", "r", "r", "r"))| Dependent: Surv(OverallTime, Outcome) | all | HR (univariable) | HR (multivariable) | |
|---|---|---|---|---|
| LVI | Absent | 152 (100.0) | NA | NA |
| Present | 98 (100.0) | 1.42 (1.04-1.94, p=0.025) | 1.42 (1.04-1.94, p=0.025) |
tUni_df <- tibble::as_tibble(tUni, .name_repair = "minimal") %>% janitor::clean_names()
tUni_df_descr <- paste0("When ", tUni_df$dependent_surv_overall_time_outcome[1],
" is ", tUni_df$x[2], ", there is ", tUni_df$hr_univariable[2], " times risk than ",
"when ", tUni_df$dependent_surv_overall_time_outcome[1], " is ", tUni_df$x[1],
".")When LVI is Present, there is 1.42 (1.04-1.94, p=0.025) times risk than when LVI is Absent.
Call: survfit(formula = Surv(OverallTime, Outcome) ~ LVI, data = mydata)
3 observations deleted due to missingness
n events median 0.95LCL 0.95UCL
LVI=Absent 151 112 20.4 14.7 26.8
LVI=Present 96 65 10.7 9.1 13.4
km_fit_median_df <- summary(km_fit)
km_fit_median_df <- as.data.frame(km_fit_median_df$table) %>% janitor::clean_names() %>%
tibble::rownames_to_column()km_fit_median_definition <- km_fit_median_df %>% dplyr::mutate(description = glue::glue("When {rowname}, median survival is {median} [{x0_95lcl} - {x0_95ucl}, 95% CI] months.")) %>%
dplyr::select(description) %>% pull()When LVI=Absent, median survival is 20.4 [14.7 - 26.8, 95% CI] months., When LVI=Present, median survival is 10.7 [9.1 - 13.4, 95% CI] months.
Call: survfit(formula = Surv(OverallTime, Outcome) ~ LVI, data = mydata)
3 observations deleted due to missingness
LVI=Absent
time n.risk n.event survival std.err lower 95% CI upper 95% CI
12 76 54 0.610 0.0419 0.533 0.698
36 19 41 0.219 0.0404 0.152 0.314
LVI=Present
time n.risk n.event survival std.err lower 95% CI upper 95% CI
12 22 49 0.386 0.0570 0.2893 0.516
36 5 12 0.152 0.0489 0.0808 0.286
km_fit_summary <- summary(km_fit, times = c(12, 36, 60))
km_fit_df <- as.data.frame(km_fit_summary[c("strata", "time", "n.risk", "n.event",
"surv", "std.err", "lower", "upper")])km_fit_definition <- km_fit_df %>% dplyr::mutate(description = glue::glue("When {strata}, {time} month survival is {scales::percent(surv)} [{scales::percent(lower)}-{scales::percent(upper)}, 95% CI].")) %>%
dplyr::select(description) %>% pull()When LVI=Absent, 12 month survival is 61.0% [53.3%-69.8%, 95% CI]., When LVI=Absent, 36 month survival is 21.9% [15.2%-31.4%, 95% CI]., When LVI=Present, 12 month survival is 38.6% [28.9%-51.6%, 95% CI]., When LVI=Present, 36 month survival is 15.2% [8.1%-28.6%, 95% CI].
dependentKM <- "Surv(OverallTime, Outcome)"
explanatoryKM <- "TStage"
mydata %>%
finalfit::surv_plot(.data = .,
dependent = dependentKM,
explanatory = explanatoryKM,
xlab='Time (months)',
pval=TRUE,
legend = 'none',
break.time.by = 12,
xlim = c(0,60)
# legend.labs = c('a','b')
)Interpret the results in context of the working hypothesis elaborated in the introduction and other relevant studies; include a discussion of limitations of the study.
Discuss potential clinical applications and implications for future research
Knijn, N., F. Simmer, and I. D. Nagtegaal. 2015. “Recommendations for Reporting Histopathology Studies: A Proposal.” Virchows Archiv 466 (6): 611–15. https://doi.org/10.1007/s00428-015-1762-3.
Schmidt, Robert L., Deborah J. Chute, Jorie M. Colbert-Getz, Adolfo Firpo-Betancourt, Daniel S. James, Julie K. Karp, Douglas C. Miller, et al. 2017. “Statistical Literacy Among Academic Pathologists: A Survey Study to Gauge Knowledge of Frequently Used Statistical Tests Among Trainees and Faculty.” Archives of Pathology & Laboratory Medicine 141 (2): 279–87. https://doi.org/10.5858/arpa.2016-0200-OA.
From Table 1: Proposed items for reporting histopathology studies. Recommendations for reporting histopathology studies: a proposal Virchows Arch (2015) 466:611–615 DOI 10.1007/s00428-015-1762-3↩︎
From Table 1: Proposed items for reporting histopathology studies. Recommendations for reporting histopathology studies: a proposal Virchows Arch (2015) 466:611–615 DOI 10.1007/s00428-015-1762-3↩︎
See childRmd/_01header.Rmd file for other general settings↩︎
Change echo = FALSE to hide codes after knitting.↩︎
See childRmd/_02fakeData.Rmd file for other codes↩︎
Synthea The validity of synthetic clinical data: a validation study of a leading synthetic data generator (Synthea) using clinical quality measures. BMC Med Inform Decis Mak 19, 44 (2019) doi:10.1186/s12911-019-0793-0↩︎
https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/s12911-019-0793-0↩︎
https://medium.com/free-code-camp/how-our-test-data-generator-makes-fake-data-look-real-ace01c5bde4a↩︎
lung, cancer, breast datası ile birleştir↩︎
See childRmd/_03importData.Rmd file for other codes↩︎
See childRmd/_04briefSummary.Rmd file for other codes↩︎
Kişisel verilerin kaydedilmesi ve kişisel verileri hukuka aykırı olarak verme veya ele geçirme Türk Ceza Kanunu’nun 135. ve 136. maddesi kapsamında bizim hukuk sistemimizde suç olarak tanımlanmıştır. Kişisel verilerin kaydedilmesi suçunun cezası 1 ila 3 yıl hapis cezasıdır. Suçun nitelikli hali ise, kamu görevlisi tarafından görevin verdiği yetkinin kötüye kullanılarak veya belirli bir meslek veya sanatın sağladığı kolaylıktan yararlanılarak işlenmesidir ki bu durumda suçun cezası 1.5 ile 4.5 yıl hapis cezası olacaktır.↩︎
See childRmd/_06variableTypes.Rmd file for other codes↩︎
See childRmd/_07overView.Rmd file for other codes↩︎
Statistical Literacy Among Academic Pathologists: A Survey Study to Gauge Knowledge of Frequently Used Statistical Tests Among Trainees and Faculty. Archives of Pathology & Laboratory Medicine: February 2017, Vol. 141, No. 2, pp. 279-287. https://doi.org/10.5858/arpa.2016-0200-OA↩︎
From Table 1: Proposed items for reporting histopathology studies. Recommendations for reporting histopathology studies: a proposal Virchows Arch (2015) 466:611–615 DOI 10.1007/s00428-015-1762-3↩︎
See childRmd/_11descriptives.Rmd file for other codes↩︎
See childRmd/_18survival.Rmd file for other codes, and childRmd/_19shinySurvival.Rmd for shiny application↩︎
JAMA retraction after miscoding – new Finalfit function to check recoding↩︎
See childRmd/_23footer.Rmd file for other codes↩︎
Smith AM, Katz DS, Niemeyer KE, FORCE11 Software Citation Working Group. (2016) Software Citation Principles. PeerJ Computer Science 2:e86. DOI: 10.7717/peerj-cs.86 https://www.force11.org/software-citation-principles↩︎
A work by Serdar Balci
drserdarbalci@gmail.com